home *** CD-ROM | disk | FTP | other *** search
/ PCNet 2004 October / PCNET_CD_2004_10_1.iso / shareware / SESDemo.exe / {app} / CGI / cgiwrap.jsp < prev    next >
Encoding:
Text File  |  2004-06-29  |  893 b   |  38 lines

  1. <%@ page import="java.net.*,java.io.*" %>
  2.  
  3. <%@include file="header.htm" %>
  4.  
  5. <%
  6. String cgiPath = "/cgi-bin/sessearch.cgi";
  7. String scrName = request.getRequestURI();
  8. String query = request.getQueryString();
  9. if (query != null && query.length () > 0)
  10. {
  11.     URL url;
  12.     String address = cgiPath + "?" + query + "&wrap=" + scrName;
  13.     try
  14.     {
  15.         url = new URL (address);
  16.     }
  17.     catch (MalformedURLException e)
  18.     {
  19.         String fullURL = request.getRequestURL ().toString ();
  20.         URL thisURL = new URL (fullURL);
  21.         url = new URL (thisURL.getProtocol (), thisURL.getHost (), thisURL.getPort (), address);
  22.     }
  23.  
  24.     URLConnection connection = url.openConnection();
  25.     InputStream stream = connection.getInputStream();
  26.     BufferedInputStream in = new BufferedInputStream(stream);
  27.     int i;
  28.     while ((i = in.read()) != -1)
  29.     {
  30.         out.write(i);
  31.     }
  32.     out.flush();
  33. }
  34.  
  35. %>
  36.  
  37. <%@include file="footer.htm" %>
  38.